public class DuoTaiDemo06 {
    public static void main(String[] args) {
        Cat cat = new Cat();
        // 父类的引用指向子类对象
        Animal animal = new Cat();
        animal.eat();
        ((Cat) animal).upTree();

    }
}


class Animal {
    public void eat() {
        System.out.println("吃");
    }
}


class Cat extends Animal {

    public void upTree() {
        System.out.println("上树 ");
    }
}

class Pig extends Animal{

}
